--http://logging.admicro.vn/crossdomain.xml
local biz_name = "crossdomain.xml"

local function _crossdomain_xml()
return coroutine.create(function ()
local http_server_name = config.http.servername
-- headers
local SERVER_HEADER = config.SERVER_HEADER
local EXPIRES_HEADER = config.EXPIRES_HEADER
local CONTENT_TYPE_HEADER = config.CONTENT_TYPE_HEADER
local CACHE_CONTROL_HEADER = config.CACHE_CONTROL_HEADER
-- functions
local reply_pushHeader = reply.pushHeader
local reply_ok = reply.status_type.ok
local reply_setStatus = reply.setStatus
local reply_appendContent = reply.appendContent
local os_time = os.time
local os_date = os.date
local coroutine_yield = coroutine.yield

while true do
    reply_pushHeader(CACHE_CONTROL_HEADER, "max-age=300, must-revalidate")
    reply_pushHeader(EXPIRES_HEADER, os_date("%a, %d %b %Y %H:%M:%S",os_time() + 300))
    reply_pushHeader(CONTENT_TYPE_HEADER, "text/xml")
    reply_pushHeader(SERVER_HEADER, http_server_name)
    reply_setStatus(reply_ok)
    reply_appendContent("<cross-domain-policy>\n"
                        ,"<allow-access-from domain=\"*\" />\n"
                        ,"</cross-domain-policy>\n")
    coroutine_yield()
end
end)
end


creators[biz_name] = function()
    f[biz_name] = _crossdomain_xml()
end
